package com.lgb.DAO;

import com.lgb.pojo.Type;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface TypeRepository extends JpaRepository<Type, Long> {
    //通过name查询
    Type findByName(String name);

    //根据对应分类具有的博客数排序，返回前n个
    @Query("select t from Type t")
    List<Type> findTop(Pageable pageable);
}
